/**
 * 
 */
package com.miolr.module.core.config;

import static org.junit.Assert.assertNotNull;

import javax.inject.Inject;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.miolr.module.core.model.User;
import com.miolr.module.core.service.UserService;

/**
 * @author iday
 *
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = HibernateDevConfig.class)
@ActiveProfiles("dev")
public class HibernateConfigTestCase {
	@Inject
	UserService userService;

	public void setUserService(UserService userService) {
		this.userService = userService;
	}

	/**
	 * Test method for {@link com.miolr.module.core.config.HibernateConfig#sessionFactory()}.
	 */
	@Test
	public void testSessionFactory() {
		User u = new User();
		userService.save(u);
		assertNotNull(u.getLastModified());
		assertNotNull(u.getId());
	}

}
